`
https://leetcode.cn/problems/shuffle-an-array/
`

/**
 * @param {number[]} nums
 */
var Solution = function (nums) {
  this.nums = nums
  this.copy = nums.slice()
};

/**
* @return {number[]}
*/
Solution.prototype.reset = function () {
  return this.nums
};

/**
* @return {number[]}
*/
Solution.prototype.shuffle = function () {
  const n = this.nums.length;
  for (let i = 0; i < n; i++) {
    // 生成一个 [i, n-1] 区间内的随机数
    const r = i + Math.floor(Math.random() * (n - i));
    // 交换 copy[i] 和 copy[r]
    [this.copy[i], this.copy[r]] = [this.copy[r], this.copy[i]];
  }
  return this.copy
};

/** 
* Your Solution object will be instantiated and called as such:
* var obj = new Solution(nums)
* var param_1 = obj.reset()
* var param_2 = obj.shuffle()
*/